
//
//  ZDQTpicNewsCollectionViewCell.m
//  Alltelevisionnews
//
//  Created by dllo on 15/11/29.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "ZDQTpicNewsCollectionViewCell.h"

@implementation ZDQTpicNewsCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        self.photoImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.photoImageView];
//        self.photoImageView.layer.borderWidth = 1;
        
        self.backLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.backLabel];
        self.backLabel.backgroundColor = [UIColor blackColor];
        self.backLabel.alpha = 0.5;
        self.backLabel.layer.cornerRadius = 20;
        self.backLabel.layer.masksToBounds = YES;
        
        self.topImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.topImageView];
//        self.topImageView.backgroundColor = [UIColor whiteColor];
        self.topImageView.image = [UIImage imageNamed:@"play.png"];
        
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
//        self.titleLabel.layer.borderWidth = 1;
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        
        
    }
    
    return self;
    
}



- (void)layoutSubviews {
    
    [self.photoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).with.offset(0);
        make.left.equalTo(self.contentView).with.offset(0);
        make.right.equalTo(self.contentView).with.offset(0);
        make.height.equalTo(self.contentView.mas_height).with.offset(-self.contentView.frame.size.height / 2 + 20);
        
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.photoImageView.mas_bottom).with.offset(0);
        make.left.equalTo(self.contentView).with.offset(0);
        make.right.equalTo(self.contentView).with.offset(0);
        make.height.equalTo(self.contentView.mas_height).with.offset(-self.contentView.frame.size.height / 2 - 20);
        
    }];
    
    [self.backLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.photoImageView).with.offset(20);
        make.left.equalTo(self.photoImageView).with.offset(55);
        make.right.equalTo(self.photoImageView).with.offset(-55);
        make.bottom.equalTo(self.photoImageView).with.offset(-20);
        
    }];
    
    [self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.backLabel).with.offset(10);
        make.left.equalTo(self.backLabel).with.offset(10);
        make.right.equalTo(self.backLabel).with.offset(-10);
        make.bottom.equalTo(self.backLabel).with.offset(-10);
        
    }];

    
    
}



@end
